import os

import yaml

from common import tools


class GetConf:
    def __init__(self):
        current_file_path = os.path.abspath(__file__)
        print(current_file_path)
        project_path = tools.get_project_path()
        with open(project_path + tools.sep(["configuration", "environment.yaml"], add_sep_before=True), "r",
                  encoding="UTF-8") as env_file:
            self.env = yaml.load(env_file, Loader=yaml.FullLoader)
        print(self.env)

    def get_projects(self):
        return self.env["project"]

    def get_project(self, index):
        return self.env["project"][index]

    def get_browser(self):
        return self.env["browser"]


config = GetConf()
